package sunwin.yoms.comm;

/**
 * Created by mt on 2015/7/29.
 */
public class YomsException extends Exception {

    private int level = 3;
    private Object tag;

    public YomsException() {
    }

    public YomsException(String message) {
        super(message);
    }
    public YomsException(String message, Throwable cause) {
        super(message, cause);
    }
    public YomsException(Throwable cause) {
        super(cause);
    }
    public YomsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
    public YomsException(String message, int level) {
        super(message);
        this.level = level;
    }

    public static YomsException getInstance(){
        return new YomsException();
    }
    public static YomsException getInstance(String message){
        return new YomsException(message);
    }
    public static YomsException getInstance(String message, int level){
        return new YomsException(message, level);
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        if (level <= 0) {
            this.level = 1;
        } else if (level > 3) {
            this.level = 3;
        } else {
            this.level = level;
        }
    }

    public Object getTag() {
        return tag;
    }

    public void setTag(Object tag) {
        this.tag = tag;
    }
}
